Cleaned SLL(1) Grammars are SLR(1)
نویسنده
چکیده
We establish the following specific relation between contextfree grammars that have LL(k) and LR(k) parsers, respectively: after cleaning an SLL(1) grammar (by unfolding its empty productions), the resulting grammar is SLR(1).
منابع مشابه
Parsing with Pictures
The development of elegant and practical algorithms for parsing context-free languages is one of the major accomplishments of 20 century Computer Science. These algorithms are presented in the literature using string rewriting systems or abstract machines like pushdown automata, but the resulting descriptions are unsatisfactory for several reasons. First, even a basic understanding of parsing a...
متن کاملSimple LR ( k ) Grammars Franklin
A class of context-free grammars, called the "Simple LR(k)" or SLR(k) grammars is defined. This class has been shown to include weak precedence and simple precedence grammars as proper subsets. How to construct parsers for the SLR(k) grammars is also shown. These parser-construction techniques are extendible to cover all of the LR(k) grammars of Knuth; they have been implemented and by direct c...
متن کاملRecursive Ascent-Descent Parsing
Generalized left-corner parsing was originally presented as a technique for generating a parser for the SLR(1) class of grammars but with far fewer states than the SLR(1) parser. This paper modi es and extends the formulation of left-corner parsers so that it is possible to apply the technique to the LALR(1) and LR(1) classes of grammars. It is further shown that left-corner parsers can be conv...
متن کاملPredictive Shift-Reduce Parsing for Hyperedge Replacement Grammars
Graph languages defined by hyperedge replacement grammars can be NP-complete. We study predictive shift-reduce (PSR) parsing for a subclass of these grammars, which generalizes the concepts of SLR(1) string parsing to graphs. PSR parsers run in linear space and time. In comparison to the predictive top-down (PTD) parsers recently developed by the authors, PSR parsing is more efficient and more ...
متن کاملVerified, Executable Parsing
We describe the mechanisation of an SLR parser produced by a parser generator, covering background properties of context-free languages and grammars, as well as the construction of an SLR automaton. Among the various properties proved about the parser we show, in particular, soundness: if the parser results in a parse tree on a given input, then the parse tree is valid with respect to the gramm...
متن کامل